project(dhd_fs)

cmake_minimum_required( VERSION 2.8 )

include_directories( /home/thomas.cocagne/dhd_tools/include )
link_directories( /home/thomas.cocagne/dhd_tools/lib )

find_package(Protobuf REQUIRED)


add_definitions( -D_FILE_OFFSET_BITS=64 )

#add_definitions( -DNO_USE_GCC_BUILTINS )

set(CMAKE_C_FLAGS -ggdb)
set(CMAKE_CXX_FLAGS -ggdb)

include_directories( /usr/include/fuse ${PROTOBUF_INCLUDE_DIRS} )
      
include_directories(${CMAKE_CURRENT_BINARY_DIR})

PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS dhd_fs.proto)


add_executable(dhd_client buffers.cpp         buffers.h
                          event_notifier.cpp  event_notifier.h
                          refcount.cpp        refcount.h
                          socket_io.cpp       socket_io.h
                          srp_openssl.c       srp.h 
                          c_client.cpp        c_client.h
                          c_config.cpp        c_config.h
                          c_connection.cpp    c_connection.h
                          c_fuse.cpp
                          c_interaction.cpp   c_interaction.h
                          c_main.cpp
                          c_server_thread.cpp c_server_thread.h
                          ${PROTO_SRCS} ${PROTO_HDRS})   


add_executable(dhd_server buffers.cpp         buffers.h
                          refcount.cpp        refcount.h
                          socket_io.cpp       socket_io.h
                          srp_openssl.c       srp.h 
                          s_config.cpp        s_config.h
                          s_connection.cpp    s_connection.h
                          s_fuse_backend.cpp  s_fuse_backend.h
                          s_main.cpp
                          s_server.cpp        s_server.h
                          s_srp_database.cpp  s_srp_database.h
                          ${PROTO_SRCS} ${PROTO_HDRS})   

target_link_libraries(dhd_client boost_thread boost_filesystem boost_system ${PROTOBUF_LIBRARY} pthread fuse rt dl ssl)

target_link_libraries(dhd_server boost_thread boost_filesystem boost_program_options boost_system ssl sqlite3 ${PROTOBUF_LIBRARY})


